#pragma once

#include "Mathematica.h"
#include <cmath>

namespace congruent_packing
{

template<class nesting_problem_t>
class threshold_objective_t
{
public:
	threshold_objective_t( nesting_problem_t & _nesting_info )
	: nesting_info( _nesting_info )
	{}

	bool operator()( const PointF & point, size_t index, double T )
	{
		double oldValue = Mathematica::minDistance2Point( index, nesting_info.points[index], nesting_info.points );
		double newValue = Mathematica::minDistance2Point( index, point, nesting_info.points );

		return oldValue * (1 - T) <= newValue;
	}

private:
	nesting_problem_t & nesting_info;
};

}